package function

import (
	"database/sql"
	"database/structs"
	"fmt"
	"github.com/jinzhu/gorm"
)

func Delete(db *gorm.DB, data structs.Company) {

	err := db.Table("macfamilytree").Where("id=7", data.Id).Delete("macfamilytree").Error
	//sqlStatement3 := `
	//DELETE FROM company
	//WHERE id=6`
	//var result3 company
	//row2 := db.QueryRow(sqlStatement3)
	//err = row2.Scan(&result3.id, &result3.name, &result3.age, &result3.address, &result3.salary, &result3.join_date)
	switch err {
	case sql.ErrNoRows:
		fmt.Println("Delete complete!")
		return
	case nil:
		fmt.Println("failed!")
	default:
		panic(err)
	}
}
//